import { defHttp } from '/@/utils/http/axios';
import { IPostUnitUpdateRaw } from '/@/types/system/auxiliary/unit/update';
import { IPostUnitCheckCodeUniqueQuery } from '/@/types/system/auxiliary/unit/checkCodeUnique';
import { IPostUnitListRequest, IPostUnitListResponse } from '/@/types/system/auxiliary/unit/list';
import { IGetRawUnitDetailsResponse } from '/@/types/system/auxiliary/unit/details';
import { IPostUnitAddRequest } from '/@/types/system/auxiliary/unit/add';

/**
 * 修改商品单位
 */
export const apiPostUnitUpdatePath = (unitId: string | number, params: IPostUnitUpdateRaw) =>
  defHttp.post({ url: `/system/auxiliary/unit/update/${unitId}`, params });
/**
 * 删除商品单位
 */
export const apiGetUnitDeletePath = (unitId: string | number) => defHttp.get({ url: `/system/auxiliary/unit/delete/${unitId}` });
/**
 * 商品单位code是否存在
 */
export const apiPostUnitCheckCodeUniqueQuery = (params: IPostUnitCheckCodeUniqueQuery) =>
  defHttp.postForm({ url: `/system/auxiliary/unit/checkCodeUnique`, params });
/**
 * 商品单位列表
 */
export const apiPostUnitList = (params: IPostUnitListRequest) => defHttp.post<IPostUnitListResponse>({ url: `/system/auxiliary/unit/list`, params });
/**
 * 商品单位详情
 */
export const apiGetUnitDetailsPath = (id: string | number) =>
  defHttp.get<IGetRawUnitDetailsResponse>({ url: `/system/auxiliary/unit/details/${id}` });
/**
 * 新增商品单位
 */
export const apiPostUnitAdd = (params: IPostUnitAddRequest) => defHttp.post({ url: `/system/auxiliary/unit/add`, params });
